﻿namespace jzgl
{
    using jzgl.Controller;
    using jzgl.Properties;
    using jzgl.Windows;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Windows.Forms;

    public class Main : Form
    {
        private IContainer components;
        private ConnDB conn;
        private string house;
        private MenuStrip menuStrip1;
        public Panel pnlCenter;
        private StatusStrip statusStrip1;
        private int t;
        private DataTable table;
        private ToolStrip toolStrip1;
        private ToolStripButton toolStripButton_calc;
        private ToolStripButton toolStripButton_Exit;
        private ToolStripButton toolStripButton_新预算;
        private ToolStripButton toolStripButton4;
        private ToolStripButton toolStripButton5;
        private ToolStripButton toolStripButton工程一览;
        private ToolStripSeparator toolStripMenuItem1;
        private ToolStripSeparator toolStripMenuItem2;
        private ToolStripSeparator toolStripMenuItem3;
        private ToolStripStatusLabel toolStripStatusLabel1;
        private string user_name;
        private SysUserDB userDB;
        private ToolStripMenuItem 帮助HToolStripMenuItem;
        private ToolStripMenuItem 帮助主题ToolStripMenuItem;
        private ToolStripMenuItem 程序选项ToolStripMenuItem;
        private ToolStripMenuItem 导入预算ToolStripMenuItem;
        private ToolStripMenuItem 工程一览ToolStripMenuItem;
        private ToolStripMenuItem 关于ToolStripMenuItem;
        private ToolStripMenuItem 基础数据ToolStripMenuItem;
        private ToolStripMenuItem 计算器ToolStripMenuItem;
        private ToolStripMenuItem 记事本ToolStripMenuItem;
        private ToolStripMenuItem 家装预算ToolStripMenuItem;
        private ToolStripMenuItem 设计师管理ToolStripMenuItem;
        private ToolStripMenuItem 实用工具TToolStripMenuItem;
        private ToolStripMenuItem 数据备份ToolStripMenuItem1;
        private ToolStripMenuItem 数据管理ToolStripMenuItem;
        private ToolStripMenuItem 数据还原ToolStripMenuItem;
        private ToolStripMenuItem 退出系统ToolStripMenuItem;
        private ToolStripMenuItem 物料管理ToolStripMenuItem;
        private ToolStripMenuItem 物料管理ToolStripMenuItem1;
        private ToolStripMenuItem 物料类别ToolStripMenuItem;
        private ToolStripMenuItem 系统管理ToolStripMenuItem;
        private ToolStripMenuItem 新预算ToolStripMenuItem;
        private ToolStripMenuItem 修改密码ToolStripMenuItem;
        private ToolStripMenuItem 用户管理ToolStripMenuItem;
        private ToolStripMenuItem 正版注册ToolStripMenuItem;
        private ToolStripMenuItem 注销用户ToolStripMenuItem;
        private ToolStripMenuItem 装饰风格ToolStripMenuItem;
        private ToolStripMenuItem 自动备份ToolStripMenuItem;

        public Main()
        {
            this.components = null;
            this.conn = new ConnDB();
            this.table = null;
            this.userDB = new SysUserDB();
            this.user_name = "";
            this.t = 0;
            this.house = "";
            this.InitializeComponent();
        }

        public Main(string name)
        {
            this.components = null;
            this.conn = new ConnDB();
            this.table = null;
            this.userDB = new SysUserDB();
            this.user_name = "";
            this.t = 0;
            this.house = "";
            this.InitializeComponent();
            this.user_name = name;
        }

        public void BackDB()
        {
            try
            {
                string str = DateTime.Now.ToString("yyyyMMddHHmmss");
                string str2 = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"backup\";
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.InitialDirectory = str2;
                dialog.FileName = str;
                dialog.Filter = "(*.bak)|*.bak ";
                dialog.FilterIndex = 0;
                dialog.RestoreDirectory = true;
                dialog.CreatePrompt = true;
                dialog.Title = "数据备份";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string savefilePath = "" + dialog.FileName;
                    base.Enabled = false;
                    this.conn.Back_DataBase(savefilePath);
                    MessageBox.Show("备份完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    base.Enabled = true;
                }
                else
                {
                    MessageBox.Show("数据备份未完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            catch (Exception)
            {
            }
        }

        private bool checkChildFrmExist(string childFrmName)
        {
            bool flag = false;
            foreach (Form form in base.MdiChildren)
            {
                if (form.Name == childFrmName)
                {
                    if (form.WindowState == FormWindowState.Minimized)
                    {
                        form.WindowState = FormWindowState.Normal;
                    }
                    form.Activate();
                    flag = true;
                    MessageBox.Show("请关闭当前已打开子窗口！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            return flag;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Main));
            this.menuStrip1 = new MenuStrip();
            this.家装预算ToolStripMenuItem = new ToolStripMenuItem();
            this.新预算ToolStripMenuItem = new ToolStripMenuItem();
            this.导入预算ToolStripMenuItem = new ToolStripMenuItem();
            this.工程一览ToolStripMenuItem = new ToolStripMenuItem();
            this.物料管理ToolStripMenuItem = new ToolStripMenuItem();
            this.物料类别ToolStripMenuItem = new ToolStripMenuItem();
            this.物料管理ToolStripMenuItem1 = new ToolStripMenuItem();
            this.基础数据ToolStripMenuItem = new ToolStripMenuItem();
            this.设计师管理ToolStripMenuItem = new ToolStripMenuItem();
            this.装饰风格ToolStripMenuItem = new ToolStripMenuItem();
            this.系统管理ToolStripMenuItem = new ToolStripMenuItem();
            this.用户管理ToolStripMenuItem = new ToolStripMenuItem();
            this.修改密码ToolStripMenuItem = new ToolStripMenuItem();
            this.toolStripMenuItem1 = new ToolStripSeparator();
            this.注销用户ToolStripMenuItem = new ToolStripMenuItem();
            this.退出系统ToolStripMenuItem = new ToolStripMenuItem();
            this.数据管理ToolStripMenuItem = new ToolStripMenuItem();
            this.数据备份ToolStripMenuItem1 = new ToolStripMenuItem();
            this.数据还原ToolStripMenuItem = new ToolStripMenuItem();
            this.toolStripMenuItem3 = new ToolStripSeparator();
            this.程序选项ToolStripMenuItem = new ToolStripMenuItem();
            this.自动备份ToolStripMenuItem = new ToolStripMenuItem();
            this.实用工具TToolStripMenuItem = new ToolStripMenuItem();
            this.记事本ToolStripMenuItem = new ToolStripMenuItem();
            this.计算器ToolStripMenuItem = new ToolStripMenuItem();
            this.帮助HToolStripMenuItem = new ToolStripMenuItem();
            this.帮助主题ToolStripMenuItem = new ToolStripMenuItem();
            this.关于ToolStripMenuItem = new ToolStripMenuItem();
            this.toolStripMenuItem2 = new ToolStripSeparator();
            this.正版注册ToolStripMenuItem = new ToolStripMenuItem();
            this.toolStrip1 = new ToolStrip();
            this.toolStripButton_新预算 = new ToolStripButton();
            this.toolStripButton工程一览 = new ToolStripButton();
            this.toolStripButton4 = new ToolStripButton();
            this.toolStripButton5 = new ToolStripButton();
            this.toolStripButton_calc = new ToolStripButton();
            this.toolStripButton_Exit = new ToolStripButton();
            this.statusStrip1 = new StatusStrip();
            this.toolStripStatusLabel1 = new ToolStripStatusLabel();
            this.pnlCenter = new Panel();
            this.menuStrip1.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            base.SuspendLayout();
            this.menuStrip1.Items.AddRange(new ToolStripItem[] { this.家装预算ToolStripMenuItem, this.物料管理ToolStripMenuItem, this.基础数据ToolStripMenuItem, this.系统管理ToolStripMenuItem, this.数据管理ToolStripMenuItem, this.实用工具TToolStripMenuItem, this.帮助HToolStripMenuItem });
            this.menuStrip1.Location = new Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new Size(0x3e0, 0x18);
            this.menuStrip1.TabIndex = 0;
            this.menuStrip1.Text = "menuStrip1";
            this.家装预算ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.新预算ToolStripMenuItem, this.导入预算ToolStripMenuItem, this.工程一览ToolStripMenuItem });
            this.家装预算ToolStripMenuItem.Name = "家装预算ToolStripMenuItem";
            this.家装预算ToolStripMenuItem.Size = new Size(0x53, 20);
            this.家装预算ToolStripMenuItem.Text = "家装预算(&H)";
            this.新预算ToolStripMenuItem.Name = "新预算ToolStripMenuItem";
            this.新预算ToolStripMenuItem.Size = new Size(0x98, 0x16);
            this.新预算ToolStripMenuItem.Text = "新预算";
            this.新预算ToolStripMenuItem.Click += new EventHandler(this.新预算ToolStripMenuItem_Click);
            this.导入预算ToolStripMenuItem.Name = "导入预算ToolStripMenuItem";
            this.导入预算ToolStripMenuItem.Size = new Size(0x98, 0x16);
            this.导入预算ToolStripMenuItem.Text = "导入预算";
            this.导入预算ToolStripMenuItem.Click += new EventHandler(this.导入预算ToolStripMenuItem_Click);
            this.工程一览ToolStripMenuItem.Name = "工程一览ToolStripMenuItem";
            this.工程一览ToolStripMenuItem.Size = new Size(0x98, 0x16);
            this.工程一览ToolStripMenuItem.Text = "工程一览";
            this.工程一览ToolStripMenuItem.Click += new EventHandler(this.工程一览ToolStripMenuItem_Click);
            this.物料管理ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.物料类别ToolStripMenuItem, this.物料管理ToolStripMenuItem1 });
            this.物料管理ToolStripMenuItem.Name = "物料管理ToolStripMenuItem";
            this.物料管理ToolStripMenuItem.Size = new Size(0x53, 20);
            this.物料管理ToolStripMenuItem.Text = "物料管理(&M)";
            this.物料类别ToolStripMenuItem.Name = "物料类别ToolStripMenuItem";
            this.物料类别ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.物料类别ToolStripMenuItem.Text = "物料类别";
            this.物料类别ToolStripMenuItem.Click += new EventHandler(this.物料类别ToolStripMenuItem_Click);
            this.物料管理ToolStripMenuItem1.Name = "物料管理ToolStripMenuItem1";
            this.物料管理ToolStripMenuItem1.Size = new Size(0x76, 0x16);
            this.物料管理ToolStripMenuItem1.Text = "物料管理";
            this.物料管理ToolStripMenuItem1.Click += new EventHandler(this.物料管理ToolStripMenuItem1_Click);
            this.基础数据ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.设计师管理ToolStripMenuItem, this.装饰风格ToolStripMenuItem });
            this.基础数据ToolStripMenuItem.Name = "基础数据ToolStripMenuItem";
            this.基础数据ToolStripMenuItem.Size = new Size(0x53, 20);
            this.基础数据ToolStripMenuItem.Text = "基础数据(&B)";
            this.基础数据ToolStripMenuItem.Visible = false;
            this.设计师管理ToolStripMenuItem.Name = "设计师管理ToolStripMenuItem";
            this.设计师管理ToolStripMenuItem.Size = new Size(0x8e, 0x16);
            this.设计师管理ToolStripMenuItem.Text = "设计师管理";
            this.设计师管理ToolStripMenuItem.Visible = false;
            this.设计师管理ToolStripMenuItem.Click += new EventHandler(this.设计师管理ToolStripMenuItem_Click);
            this.装饰风格ToolStripMenuItem.Name = "装饰风格ToolStripMenuItem";
            this.装饰风格ToolStripMenuItem.Size = new Size(0x8e, 0x16);
            this.装饰风格ToolStripMenuItem.Text = "装饰风格管理";
            this.装饰风格ToolStripMenuItem.Click += new EventHandler(this.装饰风格ToolStripMenuItem_Click);
            this.系统管理ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.用户管理ToolStripMenuItem, this.修改密码ToolStripMenuItem, this.toolStripMenuItem1, this.注销用户ToolStripMenuItem, this.退出系统ToolStripMenuItem });
            this.系统管理ToolStripMenuItem.Name = "系统管理ToolStripMenuItem";
            this.系统管理ToolStripMenuItem.Size = new Size(0x53, 20);
            this.系统管理ToolStripMenuItem.Text = "系统管理(&C)";
            this.用户管理ToolStripMenuItem.Name = "用户管理ToolStripMenuItem";
            this.用户管理ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.用户管理ToolStripMenuItem.Text = "用户管理";
            this.用户管理ToolStripMenuItem.Click += new EventHandler(this.用户管理ToolStripMenuItem_Click);
            this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem";
            this.修改密码ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.修改密码ToolStripMenuItem.Text = "修改密码";
            this.修改密码ToolStripMenuItem.Click += new EventHandler(this.修改密码ToolStripMenuItem_Click);
            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
            this.toolStripMenuItem1.Size = new Size(0x73, 6);
            this.注销用户ToolStripMenuItem.Name = "注销用户ToolStripMenuItem";
            this.注销用户ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.注销用户ToolStripMenuItem.Text = "注销用户";
            this.注销用户ToolStripMenuItem.Click += new EventHandler(this.注销用户ToolStripMenuItem_Click);
            this.退出系统ToolStripMenuItem.Name = "退出系统ToolStripMenuItem";
            this.退出系统ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.退出系统ToolStripMenuItem.Text = "退出系统";
            this.退出系统ToolStripMenuItem.Click += new EventHandler(this.退出系统ToolStripMenuItem_Click);
            this.数据管理ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.数据备份ToolStripMenuItem1, this.数据还原ToolStripMenuItem, this.toolStripMenuItem3, this.程序选项ToolStripMenuItem });
            this.数据管理ToolStripMenuItem.Name = "数据管理ToolStripMenuItem";
            this.数据管理ToolStripMenuItem.Size = new Size(0x53, 20);
            this.数据管理ToolStripMenuItem.Text = "数据管理(&D)";
            this.数据备份ToolStripMenuItem1.Name = "数据备份ToolStripMenuItem1";
            this.数据备份ToolStripMenuItem1.Size = new Size(0x76, 0x16);
            this.数据备份ToolStripMenuItem1.Text = "数据备份";
            this.数据备份ToolStripMenuItem1.Click += new EventHandler(this.数据备份ToolStripMenuItem1_Click);
            this.数据还原ToolStripMenuItem.Name = "数据还原ToolStripMenuItem";
            this.数据还原ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.数据还原ToolStripMenuItem.Text = "数据还原";
            this.数据还原ToolStripMenuItem.Click += new EventHandler(this.数据还原ToolStripMenuItem_Click);
            this.toolStripMenuItem3.Name = "toolStripMenuItem3";
            this.toolStripMenuItem3.Size = new Size(0x73, 6);
            this.程序选项ToolStripMenuItem.DisplayStyle = ToolStripItemDisplayStyle.Text;
            this.程序选项ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.自动备份ToolStripMenuItem });
            this.程序选项ToolStripMenuItem.ForeColor = Color.Black;
            this.程序选项ToolStripMenuItem.Name = "程序选项ToolStripMenuItem";
            this.程序选项ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.程序选项ToolStripMenuItem.Text = "程序选项";
            this.自动备份ToolStripMenuItem.CheckOnClick = true;
            this.自动备份ToolStripMenuItem.Name = "自动备份ToolStripMenuItem";
            this.自动备份ToolStripMenuItem.Size = new Size(0x8e, 0x16);
            this.自动备份ToolStripMenuItem.Text = "自动备份工程";
            this.自动备份ToolStripMenuItem.Click += new EventHandler(this.自动备份ToolStripMenuItem_Click);
            this.实用工具TToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.记事本ToolStripMenuItem, this.计算器ToolStripMenuItem });
            this.实用工具TToolStripMenuItem.Name = "实用工具TToolStripMenuItem";
            this.实用工具TToolStripMenuItem.Size = new Size(0x59, 20);
            this.实用工具TToolStripMenuItem.Text = " 实用工具(&T)";
            this.记事本ToolStripMenuItem.Name = "记事本ToolStripMenuItem";
            this.记事本ToolStripMenuItem.Size = new Size(0x7c, 0x16);
            this.记事本ToolStripMenuItem.Text = "Excel文件";
            this.记事本ToolStripMenuItem.Click += new EventHandler(this.记事本ToolStripMenuItem_Click);
            this.计算器ToolStripMenuItem.Name = "计算器ToolStripMenuItem";
            this.计算器ToolStripMenuItem.Size = new Size(0x7c, 0x16);
            this.计算器ToolStripMenuItem.Text = "计算器";
            this.计算器ToolStripMenuItem.Click += new EventHandler(this.计算器ToolStripMenuItem_Click);
            this.帮助HToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { this.帮助主题ToolStripMenuItem, this.关于ToolStripMenuItem, this.toolStripMenuItem2, this.正版注册ToolStripMenuItem });
            this.帮助HToolStripMenuItem.Name = "帮助HToolStripMenuItem";
            this.帮助HToolStripMenuItem.Size = new Size(0x29, 20);
            this.帮助HToolStripMenuItem.Text = "帮助";
            this.帮助HToolStripMenuItem.Visible = false;
            this.帮助主题ToolStripMenuItem.Name = "帮助主题ToolStripMenuItem";
            this.帮助主题ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.帮助主题ToolStripMenuItem.Text = "帮助主题";
            this.关于ToolStripMenuItem.Name = "关于ToolStripMenuItem";
            this.关于ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.关于ToolStripMenuItem.Text = "关于...";
            this.关于ToolStripMenuItem.Click += new EventHandler(this.关于ToolStripMenuItem_Click);
            this.toolStripMenuItem2.Name = "toolStripMenuItem2";
            this.toolStripMenuItem2.Size = new Size(0x73, 6);
            this.正版注册ToolStripMenuItem.Name = "正版注册ToolStripMenuItem";
            this.正版注册ToolStripMenuItem.Size = new Size(0x76, 0x16);
            this.正版注册ToolStripMenuItem.Text = "正版注册";
            this.toolStrip1.Items.AddRange(new ToolStripItem[] { this.toolStripButton_新预算, this.toolStripButton工程一览, this.toolStripButton4, this.toolStripButton5, this.toolStripButton_calc, this.toolStripButton_Exit });
            this.toolStrip1.Location = new Point(0, 0x18);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new Size(0x3e0, 0x23);
            this.toolStrip1.TabIndex = 1;
            this.toolStrip1.Text = "toolStrip1";
            this.toolStripButton_新预算.Image = Resources.caiwu;
            this.toolStripButton_新预算.ImageTransparentColor = Color.Magenta;
            this.toolStripButton_新预算.Name = "toolStripButton_新预算";
            this.toolStripButton_新预算.Size = new Size(0x2d, 0x20);
            this.toolStripButton_新预算.Text = "新预算";
            this.toolStripButton_新预算.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton_新预算.Click += new EventHandler(this.toolStripButton_新预算_Click);
            this.toolStripButton工程一览.Image = Resources.ACTIVITL;
            this.toolStripButton工程一览.ImageTransparentColor = Color.Magenta;
            this.toolStripButton工程一览.Name = "toolStripButton工程一览";
            this.toolStripButton工程一览.Size = new Size(0x39, 0x20);
            this.toolStripButton工程一览.Text = "工程一览";
            this.toolStripButton工程一览.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton工程一览.Click += new EventHandler(this.toolStripButton工程一览_Click);
            this.toolStripButton4.Image = Resources.lib;
            this.toolStripButton4.ImageTransparentColor = Color.Magenta;
            this.toolStripButton4.Name = "toolStripButton4";
            this.toolStripButton4.Size = new Size(0x39, 0x20);
            this.toolStripButton4.Text = "物料管理";
            this.toolStripButton4.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton4.Click += new EventHandler(this.toolStripButton4_Click);
            this.toolStripButton5.Image = (Image)manager.GetObject("toolStripButton5.Image");
            this.toolStripButton5.ImageTransparentColor = Color.Magenta;
            this.toolStripButton5.Name = "toolStripButton5";
            this.toolStripButton5.Size = new Size(0x39, 0x20);
            this.toolStripButton5.Text = "装饰风格";
            this.toolStripButton5.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton5.Click += new EventHandler(this.toolStripButton5_Click);
            this.toolStripButton_calc.Image = Resources.Calc;
            this.toolStripButton_calc.ImageTransparentColor = Color.Magenta;
            this.toolStripButton_calc.Name = "toolStripButton_calc";
            this.toolStripButton_calc.Size = new Size(0x2d, 0x20);
            this.toolStripButton_calc.Text = "计算器";
            this.toolStripButton_calc.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton_calc.Click += new EventHandler(this.toolStripButton_calc_Click);
            this.toolStripButton_Exit.Image = Resources.Cancel1_32x32x16;
            this.toolStripButton_Exit.ImageTransparentColor = Color.Magenta;
            this.toolStripButton_Exit.Name = "toolStripButton_Exit";
            this.toolStripButton_Exit.Size = new Size(0x39, 0x20);
            this.toolStripButton_Exit.Text = "退出系统";
            this.toolStripButton_Exit.TextImageRelation = TextImageRelation.ImageAboveText;
            this.toolStripButton_Exit.Click += new EventHandler(this.toolStripButton_Exit_Click);
            this.statusStrip1.Items.AddRange(new ToolStripItem[] { this.toolStripStatusLabel1 });
            this.statusStrip1.Location = new Point(0, 0x2d4);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new Size(0x3e0, 0x16);
            this.statusStrip1.TabIndex = 3;
            this.statusStrip1.Text = "statusStrip1";
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new Size(0xad, 0x11);
            this.toolStripStatusLabel1.Text = "欢迎使用设计家装管理系统！";
            this.pnlCenter.Location = new Point(410, 0x2a9);
            this.pnlCenter.Name = "pnlCenter";
            this.pnlCenter.Size = new Size(0x24, 40);
            this.pnlCenter.TabIndex = 5;
            this.pnlCenter.Visible = false;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x3e0, 0x2ea);
            base.Controls.Add(this.pnlCenter);
            base.Controls.Add(this.statusStrip1);
            base.Controls.Add(this.toolStrip1);
            base.Controls.Add(this.menuStrip1);
            base.Icon = (Icon)manager.GetObject("$this.Icon");
            base.IsMdiContainer = true;
            base.MainMenuStrip = this.menuStrip1;
            this.MinimumSize = new Size(800, 500);
            base.Name = "Main";
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "设计家装管理系统(V1.0)";
            base.WindowState = FormWindowState.Maximized;
            base.FormClosing += new FormClosingEventHandler(this.Main_FormClosing);
            base.Load += new EventHandler(this.Main_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();


            if (File.Exists(Application.StartupPath + "\\image\\backimg.jpg"))
            {
                this.BackgroundImage = Image.FromFile(Application.StartupPath + "\\image\\backimg.jpg");
                this.BackgroundImageLayout = ImageLayout.Stretch;
            }

        }

        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定退出软件吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    e.Cancel = true;
                }
                else
                {
                    base.Dispose();
                    Application.Exit();
                }
            }
            catch (Exception)
            {
            }
        }

        private void Main_Load(object sender, EventArgs e)
        {
            this.table = this.userDB.Show_SysUser(this.user_name);
            if (this.table.Rows[0][4].ToString().Trim().Contains("普通用户"))
            {
                this.基础数据ToolStripMenuItem.Visible = false;
                this.数据管理ToolStripMenuItem.Visible = false;
                this.物料管理ToolStripMenuItem.Visible = false;
                this.用户管理ToolStripMenuItem.Visible = false;
                this.toolStripButton4.Visible = false;
                this.toolStripButton5.Visible = false;
            }
            AutoBackDB kdb = new AutoBackDB();
            if (kdb.Show_AutoBackState() == 1)
            {
                this.自动备份ToolStripMenuItem.Checked = true;
            }
            else
            {
                this.自动备份ToolStripMenuItem.Checked = false;
            }


        }

        public void RestoreDB()
        {
            string str = DateTime.Now.ToString("yyyyMMddHHmmss");
            string str2 = AppDomain.CurrentDomain.BaseDirectory.ToString() + @"backup\";
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Title = "数据还原";
            dialog.Filter = "备份文件|*.bak";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string fileName = dialog.FileName;
                string extension = Path.GetExtension(fileName);
                string str5 = Path.GetFileName(fileName);
                base.Enabled = false;
                if (extension.Contains(".bak"))
                {
                    this.conn.RestoreBase(fileName);
                    MessageBox.Show("还原完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    base.Enabled = true;
                }
                else
                {
                    MessageBox.Show("请正确选择数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    base.Enabled = true;
                }
            }
            else
            {
                MessageBox.Show("数据还原未完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }

        private void toolStripButton_calc_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start("calc.exe");
            }
            catch (Exception)
            {
            }
        }

        private void toolStripButton_Exit_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定退出软件吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    base.Dispose();
                    Application.Exit();
                }
            }
            catch (Exception)
            {
            }
        }

        private void toolStripButton_新预算_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("HouseTypeInfo"))
            {
                HouseTypeInfo info = new HouseTypeInfo(this.user_name, 1);
                info.MdiParent = this;
                info.Show();
            }
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("Mater_Info"))
            {
                Mater_Info info = new Mater_Info();
                info.MdiParent = this;
                info.Show();
            }
        }

        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("DesStyleInfo"))
            {
                DesStyleInfo info = new DesStyleInfo();
                info.MdiParent = this;
                info.Show();
            }
        }

        private void toolStripButton工程一览_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("HouseTypeInfo"))
            {
                HouseTypeInfo info = new HouseTypeInfo(this.user_name, 3);
                info.MdiParent = this;
                info.Show();
                info.Text = "工程一览";
            }
        }

        private void 导入预算ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("HouseTypeInfo"))
            {
                HouseTypeInfo info = new HouseTypeInfo(this.user_name, 4);
                info.MdiParent = this;
                info.Show();
                info.Text = "新预算";
            }
        }

        private void 工程一览ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("HouseTypeInfo"))
            {
                HouseTypeInfo info = new HouseTypeInfo(this.user_name, 3);
                info.MdiParent = this;
                info.Show();
                info.Text = "工程一览";
            }
        }

        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.checkChildFrmExist("About"))
                {
                    new About().ShowDialog();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 计算器ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start("calc.exe");
            }
            catch (Exception)
            {
            }
        }

        private void 记事本ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start("EXCEL.EXE");
            }
            catch (Exception)
            {
            }
        }

        private void 设计师管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("DesignerInfo"))
            {
                DesignerInfo info = new DesignerInfo();
                info.MdiParent = this;
                info.Show();
            }
        }

        private void 数据备份ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定要备份数据吗？", "提 示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                this.BackDB();
            }
        }

        private void 数据还原ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("数据还原将覆盖现有数据\n确定要还原吗？", "提 示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                this.RestoreDB();
            }
        }

        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定退出软件吗？", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    base.Dispose();
                    Application.Exit();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 物料管理ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("Mater_Info"))
            {
                Mater_Info info = new Mater_Info();
                info.MdiParent = this;
                info.Show();
            }
        }

        private void 物料类别ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("MaterTypeInfo"))
            {
                MaterTypeInfo info = new MaterTypeInfo();
                info.MdiParent = this;
                info.Show();
            }
        }

        private void 新预算ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!this.checkChildFrmExist("HouseTypeInfo"))
            {
                HouseTypeInfo info = new HouseTypeInfo(this.user_name, 1);
                info.MdiParent = this;
                info.Show();
            }
        }

        private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.checkChildFrmExist("UpdatePassword"))
                {
                    UpdatePassword password = new UpdatePassword(this.user_name);
                    password.MdiParent = this;
                    password.Show();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 用户管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.checkChildFrmExist("SysUsers"))
                {
                    SysUsers users = new SysUsers();
                    users.MdiParent = this;
                    users.Show();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 注销用户ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("真的要注销用户吗？", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Login login = new Login();
                    base.Dispose();
                    login.Show();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 装饰风格ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!this.checkChildFrmExist("DesStyleInfo"))
                {
                    DesStyleInfo info = new DesStyleInfo();
                    info.MdiParent = this;
                    info.Show();
                }
            }
            catch (Exception)
            {
            }
        }

        private void 自动备份ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AutoBackDB kdb = new AutoBackDB();
            if (this.自动备份ToolStripMenuItem.Checked)
            {
                kdb.Update_AutoBackState(1);
            }
            else
            {
                kdb.Update_AutoBackState(0);
            }
        }

        public int New_t
        {
            set
            {
                this.t = value;
            }
        }

        public string Set_house
        {
            set
            {
                this.house = value;
            }
        }
    }
}

